﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Youz.CreditRepay.Manage.Login" %>

<%@ Import Namespace="Youz.Common.Entity" %>
<%@ Import Namespace="Youz.Common.BLL" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="shortcut icon" href="favicon.png" />

    <title><%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Common,"SiteManageName","华东期货交易所系统后台管理") %></title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" />

    <link href="assets/css/font-awesome.min.css" rel="stylesheet" />

    <!-- Custom styles for this template -->
    <link href="assets/css/style.min.css" rel="stylesheet" />

    <style>
        body.login {
            background-color: #2155A9;
            color: #848585;
        }

        header {
            position: fixed;
            top: 0;
            background-color: rgba(13,34,67,1);
            height: 80px;
            width: 100%;
            z-index: 10;
        }

            header .header-container {
                max-width: 1200px;
                margin: 0 auto;
            }

                header .header-container img {
                    height: 40px;
                    margin-top: 20px;
                }

        footer {
            height: 40px;
            width: 100%;
            color: #999;
            text-align: center;
            padding: 10px 0 0;
            position: fixed;
            bottom: 0;
        }

            footer a {
                color: #999;
                padding: 0 12px;
            }

            footer p {
                margin: 0 0 0;
            }

        .center-container {
            /*background: url(assets/img/login_bg.jpg) no-repeat center;*/
            height: 100%;
            width: 100%;
            position: absolute;
        }

        .login-box {
            width: 370px;
            height: 375px;
            top: 25%;
            left: 50%;
            padding: 0;
            margin-top: 0;
            margin-left: -190px;
            position: absolute;
            z-index: 2;
        }

            .login-box .header {
                color: #3d3f42;
                margin: 0;
            }

            .login-box .form-group {
                margin-bottom: 15px;
            }

            .login-box a, .register-box a {
                color: #9bacc6;
                font-size: 14px;
                font-weight: normal;
            }

                .login-box a.btn {
                    color: #fff;
                    font-size: 14px;
                    margin: 20px 0 10px;
                }

            .login-box .input-group-addon.code::after {
                border-right: 1px solid #d1d4d7;
                content: "";
                height: 100%;
                position: absolute;
                right: 0;
                top: 0;
                width: 1px;
            }

        .panel {
            padding: 15px;
            border-radius: 3px;
            -webkit-box-shadow: 0 0 8px;
            -moz-box-shadow: 0 0 8px;
            box-shadow: 0 0 8px;
            box-shadow: 0 0 10px #a9a9a9;
        }

        #btnLogin {
            font-size: 18px;
        }

        .input-focus {
            box-shadow: 0 0 8px 2px #9dcfff;
        }

        .error-info .form-control, .error-info .input-group-addon, .error-info .input-group-addon.code::after {
            border-color: red;
        }

        .login-box button {
            margin: 10px 0 10px;
        }

        #imgcode {
            cursor: pointer;
        }
    </style>
</head>
<body class="login">
    <header>
        <div class="header-container">
            <img src="assets/img/logo-white.png" title="<%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Common,"SiteManageName","华东期货交易所系统后台管理") %>" alt="<%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Common,"SiteManageName","华东期货交易所系统后台管理") %>" />
        </div>
    </header>
    <div class="center-container">
        <div class="login-box">
            <div class="panel panel-default">
                <div class="header clearfix">
                    <h1 class="pull-left">登录</h1>
                    <div class="pull-right">还没有帐号？<a href="NoLogin/Register.aspx">马上注册</a></div>
                </div>
                <div class="panel-body">
                    <div class="form-group">
                        <div class="input-group col-sm-12">
                            <span class="input-group-addon"><i class="fa fa-user"></i></span>
                            <input type="text" class="form-control input-lg" id="UserName" maxlength="20" placeholder="<%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Login, "UserName", "帐号") %>" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group col-sm-12">
                            <span class="input-group-addon"><i class="fa fa-key"></i></span>
                            <input type="password" class="form-control input-lg" id="Password" maxlength="50" placeholder="<%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Login, "Password", "密码") %>" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group col-sm-12">

                            <span class="input-group-addon"><i class="fa fa-lock"></i></span>
                            <input type="text" class="form-control input-lg" id="ValidateCode" maxlength="4" placeholder="<%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Login, "ValidateCode", "验证码") %>" />
                            <div class="input-group-addon code">
                                <img id="imgcode" src="/ajax/ValidateCode.ashx" style="height: 29px;" />
                            </div>

                        </div>
                    </div>
                    <div>
                        <span style="color: #d50024; display: none;" id="errmsg"></span>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <button type="button" class="btn btn-success col-xs-12" id="btnLogin"><%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Login,"Login","登录") %></button>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <!--/row-->
    </div>
    <!--/container-->
    <footer>
        <p class="copy-info"><%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Common,"Copyright","© 2009-2017 华东期货有限公司 版权所有不得转载") %></p>
    </footer>

    <script src="assets/js/jquery-2.1.1.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.signalR-2.2.0.min.js"></script>
    <script type="text/javascript">
        if (window.location.href.toLowerCase().indexOf("login.aspx") == -1) {
            window.location = "/login.aspx";
        }

        $(document).ready(function () {

            $("#btnLogin").on("click", login);

            $("#imgcode").click(function () {
                refreshCode();
            });

            document.onkeydown = function (event) {
                var e = event || window.event || arguments.callee.caller.arguments[0];
                if (e && e.keyCode == 13) {
                    login();
                }
            };            
        });

        function login() {
            var UserName = $.trim($("#UserName").val());
            var Password = $.trim($("#Password").val());
            var ValidateCode = $.trim($("#ValidateCode").val());

            if (UserName.length == 0) {
                alert("管理员账户不能为空！");
                $("#UserName").focus();
                return false;
            }
            if (Password.length == 0) {
                alert("管理员密码不能为空！");
                $("#Password").focus();
                return false;
            }
            if (ValidateCode.length == 0) {
                alert("<%=Lang_LanguageBLL.LanguageByWebSite(LanguageModule.M_Login,"CodeEmpty","验证码不能为空！") %>");
                $("#ValidateCode").focus();
                return false;
            }

            $.ajax({
                type: "POST",
                dataType: "json",
                url: "Ajax/LoginOrLogout.ashx?type=Login",
                data: { UserName: UserName, Password: Password, ValidateCode: ValidateCode },
                success: function (data) {
                    if (data.isSuccess) {
                        window.location = "/";
                        return;
                    }
                    else {
                        refreshCode();
                        alert(data.message);
                    }
                    $("#Password").val("").focus();
                },
                error: function (message) {
                    refreshCode();
                    alert('<%=Lang_LanguageBLL.LanguageByManage(LanguageModule.M_Other,"Exception") %>');
                    $("#Password").val("").focus();
                }
            });
        }

        function refreshCode() {
            $("#imgcode").attr("src", "ajax/ValidateCode.ashx?d=" + new Date());
        }

    </script>
</body>


</html>

